import Mock from 'mockjs';
import system from '../data/system.js';
import user from '../data/user.js';
import role from '../data/role.js';
import permission from '../data/permission.js';
import runtime_config from "./config";
import dict from "../data/dict.js";
import dept from "../data/dept.js";
import emp from '../data/emp.js';
import client from '../data/client.js';


import store from '../data/a/store.js';
import account from '../data/a/account.js';
import yj from '../data/a/yj.js';
import type from '../data/a/type.js';
import tjjl from '../data/a/tjjl.js';
import product from '../data/a/product.js';

let baseURL = runtime_config[process.env.NODE_ENV].path;

let businessDataArray = [
	system, user, role, permission,dept,emp,dict, client,
	store,account,yj,type,tjjl,product
];

for (let index in businessDataArray) {
	let itemDataArray = businessDataArray[index];
	for (let jndex in itemDataArray) {
		let dataObject = itemDataArray[jndex];
		
		Mock.mock(baseURL+dataObject.key, dataObject.method, () => {
			if ("function" === typeof dataObject.data) {
				return dataObject.data();
			}
			return dataObject.data;
		});
	}
}
console.log("adsfasdfasdfasdfasdf");
console.log(Mock._mocked);